All right.
Now, let's go ahead and add a muzzle flash to our pistol.
Here's a demo.
Boom.
That's pretty cool.
Let's go ahead and get started.
I'm going to grab my gun.
I'm going to go to the Explorer window.
I'm going to go down to starter pack in starter pack.
There's my simple pistol.
I'm going to left click and hold.
I'm going to drag it up to my workspace.
Let go.
And now it's in the workspace somewhere out here.
I don't know where, but it is selected.
So if I hit the key, I frame in pretty cool.
All right, now I'm going to add a particle emitter that's going to shoot one particle every time I
shoot the pistol.
Let's open our sample pistol.
I'm going to go to the gun part.
That's the big mesh part, right?
And I'm going to hit the plus sign.
I'm going to hit an 84 attachment.
I'm going to add an attachment to my gun part.
If you click on attachment, that's where it is.
I'm going to move this attachment.
This attachment is going to hold my particle emitter.
There we go.
I'll move it, like right here.
All right.
I'm going to rename my attachment to Flash attachment Flash eight, and then on flash eight, hit the
plus.
Add a particle emitter if you don't see it, do PRP.
There we go.
And that's a lot of particles.
Let's rename our particle emitter to flash.
Here we go and change some of the settings.
I think I'm going to keep the color as white, and then I'll go to light emission.
Let's make that one.
That's going to give off some light and light influence.
I'll just make that like 0.5.
Size, we're going to make it smaller, maybe 0.5.
Let's see.
So you can change these textures.
We have the sparkle, the default sparkle texture.
I'm not going to change them.
The sparkles fine for me.
I'm going to go down a little more, though.
So lifetime, if you have like 5 to 10, which is the default, you're going to get a random number
between five and ten.
I'm just going to make it a flat .05.
So it's going to be a really real quick flash.
Right now, you can still see that it's going upward.
I don't want that.
I'm going to skip over rate.
We're going to turn that off because we're going to turn on each particle with code.
So we don't want the rate at which the particles are firing.
Right.
We're going to make that zero.
But I still want to see it while I'm working on it.
Speed.
I want to increase the speed to maybe at least 16 like a normal run, right?
Because if we're running faster than the speed of the particle, we're not going to see it.
It could go into the gun.
So you may even want to make it faster than that.
So one more configuration.
We got that going out the top and I totally went right over it in mission direction.
And it depends on which way front is on our attachment.
We could change our attachment direction, but it's fine like this.
We will try front and that's going the wrong way.
So now let's do a mission direction back.
That's the way I want it to go.
So it's going out from the gun.
We could just rotate the attachment, but it's fine like that.
Now let's turn our rate to zero because we're going to fire those little particles off with code.
Open the damage script.
And we have some variables up at the top.
Under the can shoot, let's get a reference to our particle emitter.
Local.
I'll call it flash.
We'll do script dot parent dot gun part dot flash 80 for flash attachment flash Now go down to on shoot
and if we can shoot we'll do we can do the game we can do the bang play and then do the flash emit one.
There we go.
Let's put this pistol in our starter pack so we don't have to fumble around in the world looking for
it.
Here we go.
Starter pack and hit the play.
We are in the world.
Let's try our pistol.
Nice.
Let's look for Ayers view.
Output.
Looking good.
I don't see any errors.
And let's see how it is when we're running.
Yeah, I'm good with that.
All right, so now you have a muzzle flash you can play around with that.
Can figure out how you want.
Change the color, change the textures, change the speed, maybe add trails by shooting it out real
quick.
And I will see you in the next video.